<template>
  <div>
    <jm-nav :title="title"/>
    <p class="card-title">正在跳转至微信登录:</p>
    <a class="autoLine" :href="openUrl"><span>{{ openUrl }}</span></a>
  </div>
</template>
<script>

export default {
  name: 'HomePage',
  data() {
    return {
      appId: 'wx5a45670c8eb5b65b',
      redirect_uri: 'http://wechat-web.proxy.bzchao.com/#/openId',
      openUrl: ``,
      title: '在线申请'
    }
  },
  watch: {},
  beforeRouteLeave(to, from, next) {
    // 打开详情页（或者下一个任意界面）之前，把筛选条件保存到localStorage，如果离开列表页并且打开的不是详情页则清除，也可以选择不清除
    if (to.name === 'cardStatement' || to.name === 'applyCard_02') {
      localStorage.setItem('customer', JSON.stringify(this.customer))
    } else {
      localStorage.removeItem('customer')
    }
    next()
  },
  created() {
    let redirect_uri = encodeURIComponent(this.redirect_uri)
    //跳转到微信授权页面（scope=snsapi_base不需要用户确认，直接跳转到回调页面）
    this.openUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
  },
  mounted() {
  },
  methods: {}
}
</script>

<style scoped>

.autoLine {
  /*设置内容超出后自动换行*/
  word-wrap: break-word;
  word-break: break-all;
}
</style>
